<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script src="./js/jquery-3.6.0.min.js"></script>
    <script src="./js/api.js"></script>
    <script src="./js/init.js"></script>

    <div>
        <tr>
            <input type="button" value="查找" onclick="find()">
            <input type="text" name="keywork" placeholder="查找博客标题，内容，摘要，分类，作者">

        </tr>
        <tr>
            <input type="button" value="新增" onclick="add()">
        </tr>

    </div>

    <table id="tb">
        <tr>
            <td>id</td>
            <td>标题</td>
            <td>摘要</td>
            <td>内容</td>
            <td>分类</td>
            <td>作者</td>
            <td>发表时间</td>
            <td>操作</td>
        </tr>
        <tr class="tr">
            <td>1</td>
            <td>1</td>
            <td>1</td>
            <td>1</td>
            <td>1</td>
            <td>1</td>
            <td>1</td>
            <td>
                <input type="button" value="修改" onclick="edit()">
                <input type="button" value="删除" onclick="deleted()">
            </td>
        </tr>
    </table>
    <script>
     
        function add() {
            window.location.href ='createEdit.html'
        }

        function edit(id) {
            window.location.href ='createEdit.html?id=' + id
        }
        function deleted(id) {
            deletelist(id).then(data=>{
if (data.code===1000) {
    let id=data.data.id
    $`(key=${id})`.remove()
    window.location.href='index.html'
}
            })
        }

    </script>
</body>

</html>